
package py.una.pol.raphapy.autoventas.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Rafael E. Benegas
 */
@Embeddable
public class DocumentoPersonaPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 4)
    @Column(name = "cod_tip_doc")
    private String codTipDoc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_per")
    private long codPer;

    public DocumentoPersonaPK() {
    }

    public DocumentoPersonaPK(String codTipDoc, long codPer) {
        this.codTipDoc = codTipDoc;
        this.codPer = codPer;
    }

    public String getCodTipDoc() {
        return codTipDoc;
    }

    public void setCodTipDoc(String codTipDoc) {
        this.codTipDoc = codTipDoc;
    }

    public long getCodPer() {
        return codPer;
    }

    public void setCodPer(long codPer) {
        this.codPer = codPer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipDoc != null ? codTipDoc.hashCode() : 0);
        hash += (int) codPer;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof DocumentoPersonaPK)) {
            return false;
        }
        DocumentoPersonaPK other = (DocumentoPersonaPK) object;
        if ((this.codTipDoc == null && other.codTipDoc != null) || (this.codTipDoc != null && !this.codTipDoc.equals(other.codTipDoc))) {
            return false;
        }
        if (this.codPer != other.codPer) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.raphapy.autoventas.model.DocumentoPersonaPK[ codTipDoc=" + codTipDoc + ", codPer=" + codPer + " ]";
    }
    
}
